Skip to content

Conversation

@jonathannorris
Copy link
Member

Summary

Adds support for userId field in OpenFeature Provider for Java Server SDK to match behavior across all DevCycle SDKs and OpenFeature providers.

Changes

• Enhanced DevCycleUser.fromEvaluationContext() to support userId as a fallback user ID source
• Implemented correct priority order: targetingKeyuser_iduserId
• Added type safety validation for all user ID fields (must be strings)
• Ensured all potential user ID fields are excluded from custom data
• Added comprehensive test coverage for new functionality

Test Coverage

• Priority order validation across all user ID sources
• Custom data exclusion for all user ID fields
• Type safety with non-string values
• Fallback behavior when higher priority fields are missing

Compatibility

✅ Fully backward compatible - no breaking changes
✅ All existing tests continue to pass
✅ Matches behavior of web, iOS, and Android OpenFeature providers

Resolves consistency across DevCycle SDKs per internal discussion.


Open Background Agent:
Web · Cursor

[Slack Thread](https://taplytics.slack.com/archives/C02DU5GTB6U/p1752872862815949%3Fthread_ts=1752872862.815949

cursoragent and others added 3 commits July 21, 2025 20:43
Co-authored-by: jonathan <jonathan@taplytics.com>
…stom data

Co-authored-by: jonathan <jonathan@taplytics.com>
Co-authored-by: jonathan <jonathan@taplytics.com>
@jonathannorris jonathannorris requested a review from a team as a code owner July 22, 2025 14:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for userId as a fallback user ID source in the OpenFeature Provider for Java Server SDK to maintain consistency across all DevCycle SDKs. The implementation follows a clear priority order: targetingKeyuser_iduserId.

  • Enhanced DevCycleUser.fromEvaluationContext() to support userId as the lowest priority fallback for user identification
  • Added type safety validation ensuring all user ID fields must be strings
  • Updated custom data exclusion logic to prevent user ID fields from appearing in custom data

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/main/java/com/devcycle/sdk/server/common/model/DevCycleUser.java Implements userId fallback logic with type validation and updates custom data exclusion
src/test/java/com/devcycle/sdk/server/common/model/DevCycleUserTest.java Adds comprehensive test coverage for priority order, type safety, and custom data exclusion

…r.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jonathannorris jonathannorris merged commit 4fda848 into main Jul 22, 2025
7 checks passed
@jonathannorris jonathannorris deleted the cursor/enhance-java-of-user-id-mapping-72df branch July 22, 2025 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants